import Vue from 'vue'

const echarts = require('echarts')
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import Cookies from 'js-cookie'
// import 'lib-flexible/flexible.js' // rem 转换器
import '@/styles/index.scss' // 全局CSS
import App from './App'
import store from './store'
import router from './router'
import '@/icons' // icon
import '@/permission' // permission control
import Pagination from '@/components/ucen-ui/Pagination'
import {
  resetForm,
  addDateRange,
  tran,
  getCuisine,
  getDateValues,
  addDateOrder,
  getNullNames,
  addDateOrders,
  parseTime
} from '@/utils/index'
import preventReClick from '@/utils/preventReClick'
import '@/utils/rem'
import 'default-passive-events'
Vue.use(preventReClick)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
Vue.use(ElementUI, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})
ElementUI.Dialog.props.lockScroll.default = false // 导致页面的滚动条隐藏，从而使页面出现闪动的效果。
Vue.use(ElementUI)
Vue.config.productionTip = false
// 全局方法
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.getCuisine = getCuisine
Vue.prototype.tran = tran
Vue.prototype.$echarts = echarts
Vue.prototype.getDateValues = getDateValues
Vue.prototype.addDateOrder = addDateOrder
Vue.prototype.getNullNames = getNullNames
Vue.prototype.addDateOrders = addDateOrders
Vue.prototype.parseTime = parseTime
Vue.prototype.msgSuccess = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'success' })
}

Vue.prototype.msgError = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'error' })
}

Vue.prototype.msgInfo = function(msg) {
  this.$message.info(msg)
}
// 全局组件挂载
Vue.component('Pagination', Pagination)
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
